using EnvDTE;
using Microsoft.Practices.RecipeFramework;
using VSSDKAssist.Assets.Actions.Base;

namespace VSSDKAssist.Recipes.CustomProject.CreateCustomProject
{
	/// <summary>
	/// Action that updates the package base class
	/// </summary>
    public class UpdatePackageBaseClassAction : ActionBase
	{
		#region Properties
		/// <summary>
		/// Gets or sets the project item.
		/// </summary>
		/// <value>The project item.</value>
        [Input(Required = true)]
        public CodeClass CodeClass { get; set; }
		#endregion

		#region Protected Implementation
		/// <summary>
		/// Called when [execute].
		/// </summary>
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
		protected override void OnExecute()
		{
            this.CodeClass.RemoveBase("Package");
            this.CodeClass.AddBase("Microsoft.VisualStudio.Package.ProjectPackage", -1);
		}

		/// <summary>
		/// Called when [undo].
		/// </summary>
		protected override void OnUndo()
		{
			//Do nothing
		}
		#endregion
	}
}